<!DOCTYPE html>
<html>
    <head>
        <title>draggable</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">
        <link type="text/css" rel="stylesheet" href="../style/avalon.doc.css">
        <script src="../highlight/shCore.js">

        </script>
        <script src="../avalon.js">

        </script>
        <script>
            require(["draggable/avalon.draggable"], function() {
                avalon.define("test", function(vm) {
                    vm.draggable = {
                        handle: function(e){
                            var el = e.target
                            do{
                                if(el.className === "handle"){
                                    return el
                                }
                            }while(el = el.parentNode)
                        }
                    }
                    vm.$skipArray = ["draggable"]
                })
                avalon.scan()
            })

        </script>
        <style>
            #aaa{
                width:100px;
                height: 100px;
                position: absolute;
                background: red;
                z-index: 10;
            }
            .handle{
                width:100%;
                height:30px;
                cursor: move;
                background:#8A2BE2;
            }

        </style>
    </head>
    <body>
        <div ms-controller="test" ms-draggable data-draggable-handle="handle" id="aaa">
            <div class="handle">拖我</div>
        </div>
       
        <h1>手柄拖动 handle (handle为配置对象的处理函数的名字) </h1>
        <pre class="brush:html;gutter:false;toolbar:false;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;draggable&lt;/title&gt;
        &lt;meta charset="UTF-8"&gt;
        &lt;meta name="viewport" content="width=device-width"&gt;
        &lt;script src="../highlight/shCore.js"&gt;

        &lt;/script&gt;
        &lt;script src="../avalon.js"&gt;

        &lt;/script&gt;
        &lt;script&gt;
            require(["draggable/avalon.draggable"], function() {
                avalon.define("test", function(vm) {
                    vm.draggable = {
                        handle: function(e){
                            var el = e.target
                            do{
                                if(el.className === "handle"){
                                    return el
                                }
                            }while(el = el.parentNode)
                        }
                    }
                    vm.$skipArray = ["draggable"]
                })
                avalon.scan()
            })

        &lt;/script&gt;
        &lt;style&gt;
            #aaa{
                width:100px;
                height: 100px;
                position: absolute;
                background: red;
                z-index: 10;
            }
            .handle{
                width:100%;
                height:30px;
                cursor: move;
                background:#8A2BE2;
            }

        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div ms-controller="test" ms-draggable data-draggable-handle="handle" id="aaa"&gt;
            &lt;div class="handle"&gt;拖我&lt;/div&gt;
        &lt;/div&gt;
       
        &lt;h1&gt;手柄拖动 handle (handle为配置对象的处理函数的名字) &lt;/h1&gt;
      
    &lt;/body&gt;
&lt;/html&gt;

        </pre>
    </body>
</html>
